tools='
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "get weather of location or city",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "query": {
                            "location": "location or city",
                            "type": "string"
                        }
                    },
                    "required": [
                        "query"
                    ]
                }
            }
        }
    ]
'

system='You are a helpful assistant that takes a question and finds the most appropriate tool or tools to execute, along with the parameters required to run the tool.  Respond as JSON using the following schema: {"functionName": "function name", "parameters": [{"parameterName", "name of parameter", "parameterValue": "value of parameter"}]}.  The tools are: '
content=$(echo "$system" "$tools" | jq -sR)

curl -s --location --request POST 'http://localhost:11434/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data-raw '{
    "messages": [
        {
            "role": "system",
            "content": '"$content"'
        },
        {
            "content": "what'\''s the weather of beijing",
            "role": "user"
        }
    ],
    "model": "glm4",
    "n": 1,
    "temperature": 0.9,
    "format": "json"
}'
